package com.example.demo.bean.jacksonserialize;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import org.springframework.util.StringUtils;

import java.io.IOException;

/**
 * 反序列
 * @author lyc
 * @date 2019/6/3.
 */
public class ToLowerCaseCaseSerializer extends JsonDeserializer<String> {

    @Override
    public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        JsonNode node =  jsonParser.getCodec().readTree(jsonParser);
        return node.asText().toLowerCase();
    }
}